package com.itheima.mm.controller;

import com.itheima.mm.entity.Result;
import com.itheima.mm.pojo.Industry;
import com.itheima.mm.service.IIndustryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * 包名:com.itheima.mm.controller
 * 作者:Leevi
 * 日期2020-01-16  10:56
 */
@RestController
@RequestMapping("industry")
public class IndustryController {
    @Autowired
    private IIndustryService industryService;
    @RequestMapping("findAll")
    public Result findAll(HttpServletRequest request, HttpServletResponse response) throws IOException {
        try {
            List<Industry> industryList = industryService.findAll();
            //获取方向列表成功
            return new Result(true,"获取方向列表成功",industryList);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(true,"获取方向列表失败");
        }
    }
}
